#!/bin/sh

#######BEGIN: SETTING: BASIC#########
ENV_HOME_BINARY=/tmp/binaries
ENV_HOME_CFSSL=${ENV_HOME_BINARY}/cfssl
ENV_HOME_ETCD=${ENV_HOME_BINARY}/etcd
ENV_HOME_FLANNEL=${ENV_HOME_BINARY}/flannel
ENV_HOME_DOCKER=${ENV_HOME_BINARY}/docker
ENV_HOME_IMAGES=${ENV_HOME_BINARY}/images
ENV_HOME_IMAGE_COREDNS=${ENV_HOME_IMAGES}/coredns/coredns.tar
ENV_CURRENT_HOSTIP="192.168.163.131"
ENV_MAC_CLIENT_PRF_PASSWORD=liumiaocn
ENV_CSR_AUTO_APPROVE_INTERVAL=3
ENV_DEFAULT_SLEEP_INTERVAL=3
ENV_DEFAULT_IMAGE_KEYWORD="image:"
ENV_IMAGE_ALL_LOAD_DIR="${ENV_HOME_BINARY}/images"
ENV_IMAGE_ALL_LOAD_FILES="all.tar"
#######END  : SETTING: BASIC#########

#######BEGIN: SETTING: DASHBOARD#####
ENV_DASHBOARD_YAML_DIR=etc/plugins/dashboard
ENV_DASHBOARD_YAML_FILE=kubernetes-dashboard.yaml
ENV_DASHBOARD_KEYWORD="__DASHBOARD_NODE_PORT__"
ENV_DASHBOARD_NODEPORT=33307
#######END  : SETTING: DASHBOARD#####

#######BEGIN: SETTING: COREDNS#######
ENV_COREDNS_YAML_DIR=etc/plugins/coredns
ENV_COREDNS_YAML_FILE=coredns.yaml
ENV_COREDNS_KEYWORD="__PILLAR__DNS__"
#######END  : SETTING: COREDNS#######

#######BEGIN: SETTING: HEAPSTER######
ENV_HEAPSTER_YAML_DIR=etc/plugins/heapster/1.5.4
ENV_HEAPSTER_YAML_FILE=heapster.yaml
ENV_HEAPSTER_GRAFANA_YAML_FILE=grafana.yaml
ENV_HEAPSTER_INFLUXDB_YAML_FILE=influxdb.yaml
ENV_HEAPSTER_GRAFANA_NODEPORT_KEYWORD="__HEAPSTER_GRAFANA_NODE_PORT__"
ENV_HEAPSTER_GRAFANA_NODE_PORT=33308
#######END  : SETTING: HEAPSTER######

#######BEGIN: SETTING: ETCD##########
ENV_ETCD_DIR_BIN="/usr/local/bin"
ENV_ETCD_CONF="/etc/etcd/etcd.conf"
ENV_ETCD_SERVICE="/usr/lib/systemd/system/etcd.service"
ENV_ETCD_DATA_DIR="/var/lib/etcd/"
ENV_ETCD_CLIENT_PORT=2379
ENV_ETCD_PEER_PORT=2380
#Cluster sample : etcd-01 etcd-02 etcd-03
ENV_ETCD_CURRENT_NAME="etcd-01"
ENV_ETCD_NAMES="etcd-01"
#Cluster sample : 192.168.163.131 192.168.163.132 192.168.163.133
ENV_ETCD_HOSTS="192.168.163.131"
ENV_ETCD_LOCALHOST_CLIENT="http://127.0.0.1:${ENV_ETCD_CLIENT_PORT}"
ENV_ETCD_STATE_NEW="new"
ENV_ETCD_STATE_EXISTING="existing"
ENV_ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ENV_ETCD_INITIAL_CLUSTER_STATE="${ENV_ETCD_STATE_NEW}"
#######END  : SETTING: ETCD##########

#######BEGIN: SETTING: APISERVER#####
ENV_HOME_K8S=/tmp/binaries/kubernetes
ENV_KUBE_DIR_BIN="/usr/local/bin"
ENV_KUBE_DIR_ETC="/etc/k8s"
ENV_KUBE_API_CONF="apiserver.conf"
ENV_KUBE_API_SERVICE="/usr/lib/systemd/system/kube-apiserver.service"
ENV_KUBE_API_TOKEN=token.csv
ENV_KUBE_OPT_LOGTOSTDERR=false
ENV_KUBE_OPT_LOG_LEVEL=2
ENV_KUBE_OPT_LOG_DIR=/var/log/kubernetes
ENV_KUBE_OPT_API_SSL_PORT=6443
ENV_KUBE_OPT_ALLOW_PRIVILEGE=true
ENV_K8S_CLUSTER_SERVICE_IP=10.254.0.1
ENV_KUBE_OPT_CLUSTER_IP_RANGE=10.254.0.0/16
ENV_KUBE_OPT_CLUSTER_PORT_RANGE=30000-50000
ENV_KUBE_OPT_AUTH_MODE="RBAC,Node"
ENV_KUBE_ADM_PLUGINS="NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota,NodeRestriction"
ENV_KUBE_MASTER_ADDR=127.0.0.1:8080
ENV_KUBE_MASTER_IP=192.168.163.131
ENV_KUBE_MASTER_HTTPS="https://${ENV_KUBE_MASTER_IP}:${ENV_KUBE_OPT_API_SSL_PORT}"
#######END  : SETTING: APISERVER#####

#######BEGIN: SETTING: SCHEDULER#####
ENV_KUBE_SCH_ETC=kube-scheduler.conf
ENV_KUBE_SCH_SERVICE=/usr/lib/systemd/system/kube-scheduler.service
ENV_KUBE_SCH_OPT_CONFIG="kube-scheduler.yaml"
#######END  : SETTING: SCHEDULER#####

#######BEGIN: SETTING: CONTROLLER####
ENV_KUBE_CM_ETC=controller-manager.conf
ENV_KUBE_CM_SERVICE=/usr/lib/systemd/system/kube-controller-manager.service
ENV_KUBE_OPT_LEADER_ELECT=true
ENV_KUBE_OPT_CLUSTER_NAME=kubernetes
ENV_KUBE_OPT_LOCALHOST=127.0.0.1
ENV_KUBE_OPT_CM_SECURE_PORT=10252
#######END  : SETTING: CONTROLLER####

#######BEGIN: SETTING: FLANNEL#######
ENV_FLANNEL_DIR_BIN=/usr/local/bin
ENV_FLANNEL_DIR_ETC=/etc/flannel
ENV_FLANNEL_DIR_RUN=/run/flannel
ENV_FLANNEL_ETC=flannel.conf
ENV_FLANNEL_SERVICE=/usr/lib/systemd/system/flanneld.service
ENV_FLANNEL_OPT_IFACE="enp0s3"
ENV_FLANNEL_ETCD_NETWORK_PREFIX=/coreos.com/network
ENV_FLANNEL_IP_RANGE="172.200.0.0/16"
#######END  : SETTING: FLANNEL#######

#######BEGIN: SETTING: SSL###########
ENV_SSL_CA_DIR=/etc/ssl/ca
ENV_SSL_CA_CONFIG=ca-config.json
ENV_SSL_K8S_DIR=/etc/ssl/k8s
ENV_SSL_ETCD_DIR=/etc/ssl/etcd
ENV_SSL_FLANNEL_DIR=/etc/ssl/flannel
ENV_SSL_DEFAULT_EXPIRY=87600h
ENV_SSL_PROFILE_ETCD=etcd
ENV_SSL_PROFILE_ETCD_EXPIRY=87600h
ENV_SSL_PROFILE_K8S=kubernetes
ENV_SSL_PROFILE_K8S_EXPIRY=87600h
ENV_SSL_CN="kubernetes"
ENV_SSL_ADMIN_CN="admin"
ENV_SSL_KEY_ALGO=rsa
ENV_SSL_KEY_SIZE=2048
ENV_SSL_NAMES_C=CN
ENV_SSL_NAMES_L=DaLian
ENV_SSL_NAMES_ST=LiaoNing
ENV_SSL_NAMES_O=K8S
ENV_SSL_NAMES_O_MASTER="system:masters"
ENV_SSL_NAMES_OU=System
ENV_SSL_FILE_CA_PEM="ca.pem"
ENV_SSL_FILE_CA_KEY="ca-key.pem"
ENV_SSL_FILE_CA_CONFIG="ca-config.json"
ENV_SSL_FILE_CA_CSR="ca-csr.json"
ENV_SSL_FILE_K8S_CSR="k8s-csr.json"
ENV_SSL_FILE_K8SCM_CSR="k8s-cm-csr.json"
ENV_SSL_FILE_K8SCH_CSR="k8s-sch-csr.json"
ENV_SSL_FILE_ADMIN_CSR="admin-csr.json"
ENV_SSL_FILE_ETCD_CSR="cert-etcd-csr.json"
ENV_SSL_FLANNEL_CSR=flanneld-csr.json
ENV_SSL_PROXY_CSR=kubeproxy-csr.json
ENV_SSL_ETCD_CSR_CN="etcd"
ENV_SSL_K8S_CSR_CN="kubernetes"
ENV_SSL_K8SCM_CSR_CN="system:kube-controller-manager"
ENV_SSL_K8SCH_CSR_CN="system:kube-scheduler"
ENV_SSL_PROXY_CSR_CN="system:kube-proxy"
ENV_SSL_FLANNEL_CSR_CN=flanneld
ENV_SSL_ETCD_CERT_PRIFIX="cert-etcd"
ENV_SSL_K8S_CERT_PRIFIX=cert-k8s
ENV_SSL_K8SCM_CERT_PRIFIX=cert-k8scm
ENV_SSL_K8SCH_CERT_PRIFIX=cert-k8sch
ENV_SSL_FLANNEL_CERT_PRIFIX=flanneld
ENV_SSL_PROXY_CERT_PRIFIX=cert-kubeproxy
ENV_SSL_ADMIN_CERT_PRIFIX="kubeadmin"
ENV_SSL_CSR_HOSTS_SRV="10.254.0.1"
#######END  : SETTING: SSL###########

#######BEGIN: SETTING: DOCKER########
ENV_DOCKER_DIR_BIN=/usr/local/bin
ENV_DOCKER_DIR_ETC=/etc/docker
ENV_DOCKER_FLANNEL_CONF=/run/flannel/docker
ENV_DOCKER_ETC=docker.conf
ENV_DOCKER_SERVICE=/usr/lib/systemd/system/docker.service
ENV_DOCKER_REGISTRY_MIRROR="https://hub-mirror.c.163.com"
ENV_DOCKER_OPT_LOG_MAX_SIZE="1g"
#######END  : SETTING: DOCKER########

#######BEGIN: SETTING: KUBECONFIG####
ENV_KUBECONFIG_CLUSTER=kubernetes
ENV_KUBECONFIG_EMBED_CERTS=true
ENV_KUBECONFIG_BOOTSTRAP="bootstrap.kubeconfig"
ENV_KUBECONFIG_KUBEPROXY="kube-proxy.kubeconfig"
ENV_KUBECONFIG_KUBE_SCHEDULER="kube-scheduler.kubeconfig"
ENV_KUBECONFIG_KUBE_CONTROLLER_MANAGER="kube-controller-manager.kubeconfig"
ENV_KUBECONFIG_KUBECTL="kubectl.kubeconfig"
ENV_KUBECONFIG_CLIENT_KUBELET="kubelet-bootstrap"
ENV_KUBECONFIG_CLIENT_KUBEPROXY="kube-proxy"
ENV_KUBECONFIG_CLIENT_KUBECTL="admin"
ENV_KUBECONFIG_CLIENT_KUBE_SCHEDULER="system:kube-scheduler"
ENV_KUBECONFIG_CLIENT_KUBE_CONTROLLER_MANAGER="system:kube-controller-manager"
ENV_KUBECONFIG_CONTEXT_DEFAULT=default
ENV_KUBECONFIG_ROLE_BOOTSTRAPPER="system:node-bootstrapper"
ENV_RBAC_KUBELTAPI_ROLE_BINDING="kube-apiserver:kubelet-apis"
ENV_RBAC_KUBELET_ROLE_APIADMIN="system:kubelet-api-admin"
#######END  : SETTING: KUBECONFIG####

#######BEGIN: SETTING: KUBELET#######
ENV_KUBE_KUBELET_ETC=kubelet.conf
ENV_KUBE_KUBELET_SERVICE=/usr/lib/systemd/system/kubelet.service
ENV_KUBELET_DIR_WORKING=/var/lib/kubelet
ENV_KUBE_NODE_HOSTNAME=${ENV_CURRENT_HOSTIP}
ENV_KUBELET_OPT_CONFIG=kubelet-config.yaml
ENV_KUBE_OPT_PAUSE="gcr.io/google_containers/pause-amd64:3.1"
ENV_KUBELET_OPT_EVENT_QPS=0
ENV_KUBELET_OPT_KPI_QPS=1000
ENV_KUBELET_OPT_API_BRUST=2000
ENV_KUBELET_OPT_REG_QPS=0
ENV_KUBELET_OPT_IMG_PULL_DEADLINE=30m
ENV_KUBELET_KUBECONFIG="kubelet.kubeconfig"
ENV_KUBELET_CONFIG_OPT_ANONYMOUS=false
ENV_KUBELET_CONFIG_OPT_WEBHOOK=true
ENV_KUBELET_CONFIG_OPT_MODE=Webhook
ENV_KUBELET_CONFIG_OPT_MAXPODS=2000
ENV_KUBELET_CONFIG_OPT_SERIALIZE_IMG_PULL=false
ENV_KUBELET_CONFIG_OPT_HAIRPIN="promiscuous-bridge"
ENV_KUBELET_CONFIG_OPT_CGROUP_DRIVER="cgroupfs"
ENV_KUBELET_CONFIG_OPT_REQUEST_TMO=15m
ENV_KUBELET_CONFIG_OPT_TLS_BOOTSTRAP=true
ENV_KUBELET_CONFIG_OPT_ROTATE_CERT=true
ENV_KUBELET_CONFIG_OPT_READONLY_PORT=0
ENV_KUBELET_CONFIG_OPT_PORT=10250
ENV_KUBELET_CONFIG_OPT_CLUSTER_DNS="10.254.0.2"
ENV_KUBELET_CONFIG_OPT_CLUSTER_DOMAIN="cluster.local"
ENV_KUBELET_OPT_FAIL_SWAP_ON=false
#######END  : SETTING: KUBELET#######

#######BEGIN: SETTING: KUBEPROXY#####
ENV_KUBE_PROXY_ETC=kube-proxy.conf
ENV_KUBE_PROXY_DIR_WORKING=/var/lib/k8s/kube-proxy
ENV_KUBE_PROXY_SERVICE=/usr/lib/systemd/system/kube-proxy.service
ENV_KUBE_PROXY_PROXY_CONFIG="kube-proxy-config.yaml"
ENV_KUBE_PROXY_CONFIG_PORT_HEALTH=10256
ENV_KUBE_PROXY_CONFIG_PORT_METRICS=10249
ENV_KUBE_PROXY_CONFIG_MODE=ipvs
#######END  : SETTING: KUBEPROXY#####
